export default ({ http }) => ({
  /**
   * @description 商品列表
   * @param {Object} params 携带的信息
   */
  getMallProductList(params, response) {
    return http.get('/mall/product/list', params, response)
  },
  /**
   * @description 商品详情
   * @param {Object} id 商品id
   */
  getMallProductDetails(id, response) {
    return http.get(`/mall/product/${id}`, {}, response)
  },
  /**
   * @description 商品订单详情
   * @param {Object} params 携带的信息
   */
  getMallOrderFetch(params, response, error) {
    return http.get(`/mall/order/fetch`, params, response, error)
  },
  /**
   * @description 提交商品订单
   * @param {Object} params 携带的信息
   */
  createMallOrderSubmit(params, response, error) {
    return http.post(`/mall/order/submit`, params, response, error)
  },
  /**
   * @description 收货地址列表
   * @param {Object}
   */
  getMallAddressList(response) {
    return http.get(`/mall/address/list`, {}, response)
  },
  /**
   * @description 添加收货地址
   * @param {Object} params 携带的信息
   */
  addMallAddress(params, response) {
    return http.post(`/mall/address/add`, params, response)
  },
  /**
   * @description 删除收货地址
   * @param {Object} params 携带的信息
   */
  deleteMallAddress(params, response) {
    return http.delete(`/mall/address/del`, params, response)
  },
  /**
   * @description 修改收货地址
   * @param {Object} params 携带的信息
   */
  updateMallAddress(params, response) {
    return http.put(`/mall/address/update`, params, response)
  },
  /**
   * @description 设为默认收货地址
   * @param {Object} params 携带的信息
   */
  updateMallAddressDefault(params, response) {
    return http.put(`/mall/address/default`, params, response)
  }
})
